<?php

namespace app\admin\model;

use think\Model;
use think\Request;

class IntegralOrder extends Model
{

    // 自动写入时间戳字段
    protected $autoWriteTimestamp = false;

    // 定义时间戳字段名
    protected $createTime = false;
    protected $updateTime = false;
    protected $deleteTime = false;

    // 追加属性
   /* protected $append = [
        'add_time_text',
        'upd_time_text'
    ];*/

	public function getImageAttr($value)
	{
	    $request = Request::instance();
	    $domain = $request->domain();
		// echo $domain;//获取当前域名  
		// echo $_SERVER['HTTP_HOST'];//获取当前域名  
	    return $domain.$value;
	}
	public function getIconAttr($value)
	{
	    $request = Request::instance();
	    $domain = $request->domain();
		// echo $domain;//获取当前域名  
		// echo $_SERVER['HTTP_HOST'];//获取当前域名  
	    return $domain.$value;
	}
    public function getAddTimeTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['add_time']) ? $data['add_time'] : '');
        return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
    }


    public function getUpdTimeTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['upd_time']) ? $data['upd_time'] : '');
        return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
    }
}
